package com.twschool.practice;


public class MarsRover {

    private Position position = new Position();
    private String directions = "NESW";

    public MarsRover(int x, int y, Direction direction) {
        position.setDirection(direction);
        position.setY(y);
        position.setX(x);
    }


    public Position excute(String command) {

        if (command.length()<1) return position;
        commandStep(command.substring(0,1));
        excute(command.substring(1));
        return position;
    }

    private void commandStep(String tmpCommand) {
        switch (tmpCommand){
            case ("L"):
                position.turnLeft();
                break;
            case ("R"):
                position.turnRight();
                break;
            case ("M"):
                position.move();
                break;
        }
    }

    public void checkCommand (String command){

    }


}
